public class LogIn {
    private String userName="admin";
    private String password="123456";
    public void loginInfo(String userName,String password)
    throws UserNameException,PassWordException{//声明两个异常
        if(!this.userName.equals(userName)){
            throw new UserNameException("用户名异常！");
        }
        if(!this.password.equals(password)){
            throw new PassWordException("密码异常！");
        }
        System.out.println("登入成功");
    }

    public static void main(String[] args) {
        LogIn logIn=new LogIn();
        try{
            logIn.loginInfo("admin","123456");
        }catch(UserNameException e){
            System.out.println("捕捉到了UserNameException。。。");
            e.printStackTrace();
        }catch(PassWordException e){
            System.out.println("捕捉到了PassWordException。。。");
            e.printStackTrace();
        }finally {
            System.out.println("finally...");
        }
    }
}
